package com.cskt.petproject178.pojo.vo;

import java.util.List;

/**
 * 分页VO
 *
 * @author 27013
 **/


public class PageVO<T> {
    private Integer pageNo;
    private Integer pageSize;
    //必须通过数据库查询
    private Integer total;
    // 查询出来的总页数
    private Integer pages;
    private List<T> list;


    public static <T> PageVO<T> page(Integer pageNo, Integer pageSize, Integer total, List<T> list){
        return new PageVO<T>(pageNo,pageSize,total,list);
    }

    private PageVO(Integer pageNo, Integer pageSize, Integer total, List<T> list) {
        this.pageNo = pageNo;
        this.pageSize = pageSize;
        this.total = total;
        this.pages = (total%this.pageSize==0?total/this.pageSize:total/this.pageSize+1);
        this.list = list;
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
      this.pageNo = pageNo;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;

    }

    public Integer getTotal() {
        return total;
    }

    public void setTotal(Integer total) {
        this.total = total;
    }

    public Integer getPages() {
        return pages;
    }

    public void setPages(Integer pages) {
        this.pages = pages;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }


}
